1. Field of the Invention
The present disclosure relates to a transaction processing apparatus that processes a transaction in cooperation with a database, a transaction processing method, and a computer-readable recording medium having recorded thereon a program for realizing the same.
2. Related Art
In recent years, a system using multiple computers, that is, a so-called cloud system that serves as a scalable platform for execution of applications attracts attention. Furthermore, KVS (Key Value Store) is widely known as scalable data persistence means in the infrastructure of the cloud system.
KVS is a data store in which a unique label (key) is set in association with data (value) that is to be stored, and they are stored as a pair (KV pair). Also, particularly, one type of KVS is referred to as a “distributed KVS”, which has a function in which data can be stored in a plurality of server devices or storage devices in a distributed manner.
Furthermore, in KVS, an exclusive control method that is referred to as an optimistic exclusive control method and an exclusive control method that is referred to as a pessimistic exclusive control method are known as exclusive control methods for a transaction.
Of them, the optimistic exclusive control method is an exclusive control method that does not acquire a lock for data that is to be referenced or updated at the time of execution of a transaction. In the optimistic exclusive control method, when committing the transaction, it is checked whether or not the transaction competes against another transaction, and the commitment is settled if there is no competition, whereas the transaction is aborted if there is the competition.
On the other hand, the pessimistic exclusive control method is an exclusive control method that acquires a lock for data that is to be referenced or updated at the time of execution of a transaction. In the pessimistic exclusive control method, once a lock is acquired, another transaction is not executed until the corresponding transaction ends, and thus according to this method, it is possible to reliably control the competition between the transactions.
Of these exclusive control methods, the optimistic exclusive control method has the characteristics of excellence in scalability because no lock is acquired, which does not incur costs for lock management. Accordingly, many systems using KVS employ the optimistic exclusive control.
However, in a system that employs the optimistic exclusive control method, transactions often compete against each other when a specific KV pair is intensively updated, causing the disadvantage that an overhead increases due to retries of a transaction that has failed to be committed. Furthermore, in view of the property of the optimistic exclusive control method, a long transaction is likely to fail and it is possible that the commitment of this transaction never becomes successful.
On the other hand, when a system employs the pessimistic exclusive control method, although a failure in commitment due to a competition between transactions does not occur, there is the disadvantage that lock management serves as a bottleneck and the scalability of the system decreases.